home *** CD-ROM | disk | FTP | other *** search
-
- /* Define how to access the structure that the wait system call stores.
- On many systems, there is a structure defined for this.
- But on vanilla-ish USG systems there is not. */
-
- #ifndef atarist
-
- #ifndef HAVE_WAIT_STRUCT
- #define WAITTYPE int
- #define WIFSTOPPED(w) (((w)&0377) == 0177)
- #define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
- #define WIFEXITED(w) (((w)&0377) == 0)
- #define WRETCODE(w) ((w) >> 8)
- #define WSTOPSIG(w) ((w) >> 8)
- #define WCOREDUMP(w) (((w)&0200) != 0)
- #define WTERMSIG(w) ((w) & 0177)
- #define WSETEXIT(w, status) ((w) = (status))
- #define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8)))
- #else
- #include <sys/wait.h>
- #define WAITTYPE union wait
- #define WRETCODE(w) (w).w_retcode
- #define WSTOPSIG(w) (w).w_stopsig
- #define WCOREDUMP(w) (w).w_coredump
- #define WTERMSIG(w) (w).w_termsig
- #define WSETEXIT(w, status) ((w).w_status = (status))
- #define WSETSTOP(w,sig) \
- ((w).w_stopsig = (sig), (w).w_coredump = 0, (w).w_termsig = 0177)
- #endif
-
- #else /* atarist */
- /* Again we are different: I don't trust the libraries' wait, so I
- use my own... (It's placed in atariwait.c and should overwrite
- the libraries' symbol) */
-
- #define WAITTYPE int
-
- #define WIFEXITED(x) ((int)((x) & 0xFF00) == 0)
- #define WEXITSTATUS(x) ((int)((x) & 0xFF))
-
- #define WIFSIGNALED(x) (((int)((x) & 0xFF00) > 0) && ((int)(((x) & 0xFF) == 0)))
- #define WTERMSIG(x) ((int)(((x) & 0xFF00) >> 8))
-
- #define WIFSTOPPED(x) (((int)((x) & 0xFF) == 0x7F) && ((int)(((x) >> 8) & 0xFF) != 0))
- #define WSTOPSIG(x) ((int)(((x) >> 8) & 0xFF))
-
- #define WRETCODE(w) WTERMSIG(w)
-
- /* the following defines are used by remote.c, dunno how to emulate them */
- #define WSETEXIT(w, status)
- #define WSETSTOP(w,sig)
-
- int wait(int *x);
-
- #endif
-